package baidu;

import java.util.Scanner;

/**
 * @author zc
 * @version 1.0
 * @date 2021/9/7 16:49
 */
public class Main3 {
    static int count = 0;
    public static void main(String[] args) {

        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        int k = cin.nextInt();
        cal(n,k);
        System.out.println(count);
    }

    private static void cal(int n ,int k){

        if (n<=k || (n-k)%2!=0){
            count++;
            return ;
        }

        cal((n+k)/2,k);
        cal((n-k)/2,k);
//        return ;
    }
}
